package com.example.signsystem.service.Impl;

import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.signsystem.entity.parm.StudentsParam;
import com.example.signsystem.entity.po.StudentsPO;
import com.example.signsystem.mapper.StudentsMapper;
import com.example.signsystem.service.IStudentsService;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
@Service
public class StudentsServicelmpl extends ServiceImpl<StudentsMapper, StudentsPO> implements IStudentsService {

    @Override
    public List<StudentsPO> allStudens() {
        List<StudentsPO> studentsPOS = this.baseMapper.selectList(new LambdaQueryWrapper<StudentsPO>().eq(StudentsPO::getDelFlag, 0));
        return studentsPOS;
    }

    @Override
    public List<StudentsParam> notSign(List<String> nameList) {

        List<StudentsPO> studentsPOS = this.baseMapper.selectList(new LambdaQueryWrapper<StudentsPO>().eq(StudentsPO::getDelFlag, 0).notIn(StudentsPO::getName, nameList));
        List<StudentsParam> studentsParams = new ArrayList<StudentsParam>();
        studentsPOS.stream().forEach(a-> studentsParams.add(BeanUtil.copyProperties(a, StudentsParam.class)));
        return studentsParams;
    }


}
